package com.log6z.dashborad.enums;

import java.util.Objects;

/**
 * 用户类型
 */
public enum UserTypeEnum {

    CORP_USER(0, "企业内部"),
    CUSTOMER_USER(1, "客户"),
    CARRIER_USER(2, "承运商"),
    MINE_AREA_USER(3,"煤矿"),//煤矿用户
    HUB_USER(4,"枢纽"),//枢纽用户
    SALE_COMPANY_USER(5,"销售公司"),//销售公司用户
    STATION(6,"场站");//场站/终端电厂用户


    private Integer typeId;//用户类型id
    private String typeName;//用户类型名称

    UserTypeEnum(Integer typeId, String typeName) {
        this.typeId = typeId;
        this.typeName = typeName;
    }

    public Integer getTypeId() {
        return typeId;
    }
    public String getTypeName() {
        return typeName;
    }

    /**
     * 根据用户类型id获取UserTypeEnum
     * @param typeId
     * @return
     */
    public static UserTypeEnum getUserTypeByTypeId(Integer typeId) {
        UserTypeEnum[] values = UserTypeEnum.values();
        for (UserTypeEnum typeEnum : values) {
            if (Objects.equals(typeEnum.typeId, typeId)) {
                return typeEnum;
            }
        }
        return null;
    }
}
